using UnityEngine;
using System.Collections;

public class spawnEnemy : MonoBehaviour {

    public int onda = 1;
    public int remessa;
    public Transform enemySpawn;
    public GameObject enemy;
	public bool contar = true;
    public float tempo = 0;
	public float contRemessa = 0;
	public float cont2 = 0;
	// Use this for initialization
	void Start () {
		enemySpawn = GameObject.FindGameObjectWithTag ("spawnPoint").transform;
        remessa = 1;        

	
		
	}
	
	// Update is called once per frame
	void Update () 
	{
		   tempo += Time.deltaTime;
			
		if (tempo >= 1.6f)
		{			
//			Debug.Log("spawnou");
			Object monster = Instantiate (enemy, enemySpawn.position, Quaternion.identity);
			remessa ++;
			tempo = 0;
		}
		
        //Debug.Log("tempo: "+tempo);
		
		
		
		
		
		
	//	StartCoroutine(Tempo());
		
			
   /*     if (remessa <= 0) 
        {
            
			onda ++;
			Debug.Log("onda++");
        }
		
		if (contRemessa >= 15)
		{
			Debug.Log("contando");
			remessa = 5 + onda;        
		}*/

	}			
	IEnumerator Tempo()
	{		
			yield return new WaitForSeconds(2);
			Object monster = Instantiate(enemy, enemySpawn.position, Quaternion.identity);	
			remessa = remessa - 1;
		
	}
}
